﻿using douban.app.Views;
using doubanOAuth;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using Windows.UI.Xaml.Navigation;

namespace douban.ViewModels
{
    public class MainVm:Base.ViewModelBase
    {
        private const string ClientId = "0d6bbabc4512f9bb28433034cf38ed31";
        private const string Secret = "70857feed35a36b3";
        private const string Scope = "douban_basic_common,group_basic_r,group_basic_w";
        private const string RedirectUri = "http://www.rwecho.com/douban/callback";


        public MainVm()
        {
            Common.APIKey = ClientId;
            Common.Secret = Secret;
            Common.Scope = Scope;
            Common.RedirectUri = RedirectUri;

            RedirectCommand = new Base.DelegateCommand(() =>
            {
                if (!Common.IsValidToken())
                {
                    this.AppFrame.Navigate(typeof(LoginPage));
                }
            });
        }

        public ICommand RedirectCommand { get; private set; }

        public override Task OnNavigatedFrom(NavigationEventArgs args)
        {
          

            return null;
        }

        public override Task OnNavigatedTo(NavigationEventArgs args)
        {
           
            return null;
        }
    }
}
